<?php
/**
 * Created by PhpStorm.
 * User: Jessewang
 * Date: 2017/3/26
 * Time: 下午9:48
 */

namespace App\Service;
use Swoole;
use App\Libs\WeChatApi;

class LoginService extends BaseService
{
    public $type ; //0:qq 1:wechat 2:weibo
    public $snspai;
    function __construct($type)
    {
       $this->type = $type;
        if($this->type == 1)
        {
            $this->snsapi = new WeChatApi();
        }
    }

    function userLogin()
    {
        $userService = new UserService();

    }
    function userAutoLogin($accesstoken)
    {

    }
    function getAccessToken($code)
    {

        return $this->snsapi->getAccessToken($code);

    }

    function getUserInfo($accesstoken,$openid)
    {

        $ret = $this->snspai->getUserInfo($accesstoken,$openid);
        return $ret;
    }



}